home *** CD-ROM | disk | FTP | other *** search
- #ifdef __STDC__
- static char sccs_id[] = "@(#) strichr.c 1.0 "__DATE__" HJR";
- #else
- static char sccs_id[] = "@(#) strichr.c 1.0 23/9/91 HJR";
- #endif
-
- /* strichr.c (c) Copyright 1990 H.Rogers */
-
- #ifndef __STDC__
- #include "sys/types.h"
- #endif
- #include <string.h>
- #include <ctype.h>
-
- #ifdef __STDC__
- char *strichr(register const char *s,register int c)
- #else
- char *strichr(s,c)
- register const char *s;
- register int c;
- #endif
- {
- register int i;
-
- c = isupper(c) ? _tolower(c) : c;
-
- while (i = *s++)
- {
- i = isupper(i) ? _tolower(i) : i;
- if (i == c) return((char *)--s);
- }
-
- return(0);
- }
-
- #ifdef __STDC__
- char *strrichr(register const char *s,register int c)
- #else
- char *strrichr(s,c)
- register const char *s;
- register int c;
- #endif
- {
- register int i;
- register const char *_s;
-
- c = isupper(c) ? _tolower(c) : c;
-
- _s = 0; do
- {
- i = *s;
- i = isupper(i) ? _tolower(i) : i;
- if (i == c) _s = s;
- }
- while (s++,i);
-
- return((char *)_s);
- }
-